package net.ezsteam;

import net.ezsteam.cons.EzSteam_Urls;
import net.ezsteam.service.EzSteam_Login_Service;
import net.ezsteam.service.EzSteam_Login_Service_Rest;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;


import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class EzSteam_LoginActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ezsteam_login_activity);

		final EditText txtusername = (EditText) findViewById(R.id.txt_username);
		final EditText txtpassword = (EditText) findViewById(R.id.txt_password);
		
		Button btnsubmit = (Button) findViewById(R.id.btn_submit);
		final Button btnregister = (Button) findViewById(R.id.btn_register);
		Button btnforgotpass = (Button) findViewById(R.id.btn_forgotpass);
		Button btnmakeappoint = (Button) findViewById(R.id.btn_makeappoint);
		
		btnmakeappoint.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(EzSteam_LoginActivity.this,EzSteam_ServiceType_Activity.class);
				startActivity(intent);
				//finish();
			}
		});
		
		btnforgotpass.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
				Intent intent = new Intent(EzSteam_LoginActivity.this,EzSteam_ForgotPassword_Activity.class);
				startActivity(intent);
				//finish();
			}
		});
		
		btnregister.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(EzSteam_LoginActivity.this,EzSteam_Register_Activity.class);
				startActivity(intent);
				/*Intent intent = new Intent(EzSteam_LoginActivity.this,EzSteam_ServiceType_Activity.class);
				startActivity(intent);*/
				/*Intent intent = new Intent(EzSteam_LoginActivity.this,EzSteam_Appoinment_Activity.class);
				startActivity(intent);*/
				//finish();
				
			}
		});

		btnsubmit.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {

				if(!txtusername.getText().toString().equals("")||!txtpassword.getText().toString().equals("")){
					EzSteam_Login_Service_Rest rq = new EzSteam_Login_Service_Rest(EzSteam_LoginActivity.this,txtusername.getText().toString(),txtpassword.getText().toString());
					rq.execute(EzSteam_Urls.Login_Service);
				}else{
					Toast toast = Toast.makeText(EzSteam_LoginActivity.this, "Email And Password Fields Cannot Be Empty !! ", Toast.LENGTH_SHORT);
					toast.show();
				}

			}
		});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {

		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login, menu);
		return true;
	}


}
